<template>
    <div>
        <Nav>
            <div slot="left" @click="goBack"> &lt; </div>
            <div slot="center">我的-留言反馈</div>
            <div slot="right" >···</div>
        </Nav>
        
        <div class="message">
            <textarea name="" id="" cols="30" rows="10" placeholder="给我们留言" v-model="message"></textarea>
        </div>
        <div class="submit" >
                <div class="btn" @click="handleSubmit">提交</div>
                <div class="thanks">感谢给我们留言,我们会不断进步！</div>
        </div>
    </div>
</template>

<script>
import Nav from '@/components/common/Nav.vue';
import {noopenidrequest} from '@/network/request.js';
    export default {
        data() {
            return {
                message: ""
            }
        },
        components: {
            Nav,
        },
        methods: {
            goBack() {
                this.$router.go(-1)
            },
            async handleSubmit(){
                if (this.message != ""){
                    try {
                    const res  = await noopenidrequest({
                        url:'api/user/message',
                        data:{
                            "message":this.message
                        }
                    });
                    alert(res.data.msg)
                    console.log(res);
                } catch (error) {
                    console.log(error);
                }
                }else{
                    alert("请先填写内容哦~")
                }
                
            }
        },
    }
</script>

<style  scoped>
    .message{
        margin-top: 102px;
        width: 100%;
        display: flex;
        justify-content: center;
        
    }
    .message textarea{
        border: none;
        box-sizing: border-box;
        padding: 20px 23px;
        width: 322px;
        height: 217px;
        resize: none;
        border: 1px solid #ebeaef;
        border-radius: 5px;
        outline: none;
    }
    .message textarea::placeholder{
        color:#e3e3eb ;
    }
    .submit{
        text-align: center;
    }
    .btn{
    font-size: 16px;
    height: 50px;
    width: 325px;
    margin: 79px auto auto auto;
    color: #fff;
    text-align: center;
    line-height: 50px;
    border-radius: 25px;
    background: linear-gradient(to right, #1fcbcf 0%,#0484c3 100%);
}
.thanks{
    margin-top: 19px;
    font-size: 14px;
    color: #121639;
}
</style>